import http from "../utils/http";
import { api } from "../config/api";
import { refThrottled } from "@vueuse/shared";

//文章列表
export let search = (cur, id="", nickName = "", role = "",status="",parentId="",pageSize = 10) => {
  return http({
    url: `${api.API_URL}/api/user/search?cur=${cur}&id=${id}&nickName=${nickName}&role=${role}&status=${status}&parentId=${parentId}&pageSize=${pageSize}`,
    method: "get",
  });
};

//增
export let create = (opt) => {
  return http({
    url: `${api.API_URL}/api/user/create`,
    method: "post",
    data: opt,
  });
};
export let recharge=(opt)=>{
   return http({
    url: `${api.API_URL}/api/user/recharge`,
    method: "post",
    data: opt,
   })
};
//删
export let del = (id) => {
  return http({
    url: `${api.API_URL}/api/user/delete?id=${id}`,
    method: "get",
  });
};

//改
export let update = (opt) => {
  return http({
    url: `${api.API_URL}/api/user/update`,
    method: "post",
    data: opt,
  });
};

//文章详情
export let detail = (id) => {
  return http({
    url: `${api.API_URL}/api/user/detail?id=${id}`,
    method: "get",
  });
};

export let findField = (cid) => {
  return http({
    url: `${api.API_URL}/api/user/findField?cid=${cid}`,
    method: "get",
  });
};

export let tongji = () => {
  return http({
    url: `${api.API_URL}/api/user/tongji`,
    method: "get",
  });
};
